/*
 * JOGRE (Java Online Gaming Real-time Engine) - API
 * Copyright (C) 2004  Bob Marks (marksie531@yahoo.com)
 * http://jogre.sourceforge.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.jogre.common.comm;

import nanoxml.XMLElement;

import org.jogre.common.TransmissionException;

/**
 * Communication class which is used to disconnect a user from the system.
 *
 * @author  Bob Marks
 * @version Alpha 0.2.3
 */
public class CommDisconnect extends CommGameMessage {

	/**
	 * Constructor which specifies that a client wishes to disconnect.
	 *
	 * @param status
	 */
	public CommDisconnect () {
		super ();
	}

	/**
	 * Message sent from server to other clients.
	 *
	 * @param username
	 */
	public CommDisconnect (String username) {
	    super (username);
	}

	/**
	 * Constructor which creates a CommDisconnect object from the flatten ()
	 * method of another CommDisconnect object.
	 *
	 * @param message
	 * @throws TransmissionException
	 */
	public CommDisconnect (XMLElement message) throws TransmissionException {
		super (message);

		if (!message.getName().equals(Comm.DISCONNECT))
			throw new TransmissionException ("Error parsing CommDisconnect");
	}

	/**
	 * Flatten disconnect object.
	 *
	 * @see org.jogre.common.comm.ITransmittable#flatten()
	 */
	public XMLElement flatten () {
		return flatten (Comm.DISCONNECT);
	}
}